package com.soxing.braindata.domain.response;

import com.soxing.braindata.domain.enumeration.TokenResponseEnum;
import lombok.Data;

/**
 * 同步数据返回
 */
@Data
public class TokenResponse {

    private int code;
    private String rows;

    public TokenResponse(int code, String rows) {
        this.code = code;
        this.rows = rows;
    }

    /**
     * 成功
     *
     * @return
     */
    public static TokenResponse success(String message) {
        return new TokenResponse(TokenResponseEnum.SUCCESS.getCode(), message);
    }

    /**
     * 成功
     *
     * @return
     */
    public static TokenResponse success() {
        return new TokenResponse(TokenResponseEnum.SUCCESS.getCode(), null);
    }

    /**
     * 失败
     *
     * @return
     */
    public static TokenResponse fail() {
        return new TokenResponse(TokenResponseEnum.FAIL.getCode(), null);
    }

    /**
     * 失败
     *
     * @return
     */
    public static TokenResponse fail(String message) {
        return new TokenResponse(TokenResponseEnum.FAIL.getCode(), message);
    }
}
